<?php

namespace app\common\contrab;

use contrab\ContrabAbstract;
use contrab\Times;

class Contrab extends ContrabAbstract
{
    /**
     * @var string 定时任务标识
     */
    public $contrabName = 'contrab';

    /**
     * @var bool 是否终止
     */

    public $isStop = false;

    /**
     * 设置定时任务时间执行规则
     * @return Times|mixed
     */

    public function setContrab()
    {
        //$t = new Times(Times::MINUTE);
        // $t = new Times(Times::MINUTE, 3);
        $t = new Times(Times::SECOND, 1);
        //$t->setStartTime('2019-05-05 14:52:40');
        return $t;
    }


    /**
     * 执行定时任务 每日执行成长值
     * @return mixed|void
     */
    public function _init()
    {
        $this->trace('the order contrab is init!');
    }



    public function trace($message)
    {
        //每秒执行
        file_put_contents('txt.txt',time().PHP_EOL,FILE_APPEND);
        return true;
    }
}
